#pragma once

#include <boost/thread/thread.hpp>
#include "ApproachCalcThread.h"

class OnErrorNotifyInterface
{
public:
	virtual bool OnError(LPCTSTR stzError) = 0;
};

class CCalcThreadHolder
{
public:
	CCalcThreadHolder(CAsteroidOrbitParam::ListPtr &listPtrAsteroidOrbPrm, IApproachHolder *pApproachHolder, OnErrorNotifyInterface *pErrorNotifyInterface);
	virtual ~CCalcThreadHolder(void);

	//bool AppendTrajParam(TrajParam &trajParam);
	void Close();
	bool IsThreadDone() const;
protected:
	void do_work();
protected:
	volatile bool		m_stoprequested;
	apBoostThread		m_pThread;
	unsigned			m_nMaxThread;

	IApproachHolder					*m_pApproachHolder;
	CAsteroidOrbitParam::ListPtr	m_listPtrAsteroidOrbPrm;
	ListPtr_CApproachCalcThread		m_ListWorkThreadPtr;
	OnErrorNotifyInterface			*m_pErrorNotifyInterface;
};

typedef auto_ptr<CCalcThreadHolder> CCalcThreadHolderAP;